<?php

class Users_Form_Changepwd extends Zend_Form {

	public function init() {
		$this->setMethod('post');
		
		$old_password = $this->createElement('password', 'old_password');
		$old_password->setLabel(_('Старый пароль:'));
		$old_password->setAttrib('maxlenght', '255');
		$old_password->setAttrib('size','32');
		$old_password->setRequired(true);
		
		$password = $this->createElement('password', 'password');
		$password->setLabel(_('Новый пароль:'));
		$password->setAttrib('maxlenght', '255');
		$password->setAttrib('size','32');
		$password->setRequired(true);
		
		$confirm = $this->createElement('password', 'confirm');
		$confirm->setLabel(_('Повторите новый пароль:'));
		$confirm->setAttrib('maxlenght', '255');
		$confirm->setAttrib('size','32');
		$confirm->addValidator(new ZFEngine_Validate_InputEquals('password'),true);
		$confirm->setRequired(true);
		
		$send = $this->createElement('checkbox', 'send');
		$send->setLabel(_('Выслать новый пароль на Email'));
		$send->setDecorators(array(
				    'ViewHelper',
				    'Errors',
				    array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
				    array('Label', array('tag' => 'td'),
				    array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
				)));
		
		$submit = $this->createElement('submit', 'submit');
		$submit->setLabel(_('Изменить пароль'));
		$submit->setDecorators(array(
			    'ViewHelper',
			    array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
			    array(array('label' => 'HtmlTag'), array('tag' => 'td', 'placement' => 'append')),
			    array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
			));
		
		$this->setDecorators(array(
			    'FormElements',
			    array('HtmlTag', array('tag' => 'table')),
			    'Form',
			));
		
		$this->addElements(array($old_password,$password,$confirm,$send,$submit));
	}
}